package demo8;

/**
 * Created with IntelliJ IDEA.
 * Description:
 * User: 石方旭
 * Date: 2022-04-17
 * Time: 12:32
 */
class Cleanser{
    private String s ="cleanser";
    public void append(String a) {
        s+=a;
    }

    public void dilute() {
        append("***dilute ");
    }

    public void apply() {
        append("apply() ");
    }

    public void scrub() {
        append("Cleanser的scrub() ");
        //System.out.println("父类的scrub()");
    }

    public String toString() {
        return s;
    }
}
public class Detergent extends Cleanser{
      public void scrub() {
          System.out.print("Detergent的scurb() ");
          super.scrub();
      }

      public void foam() {
          System.out.print("Detergent的foam() ");
          append("foam");
      }

    public static void main(String[] args) {
        Detergent x = new Detergent();
        x.dilute();
        x.apply();
        x.scrub();
        x.foam();
        System.out.println(x);
    }


}
